package com.niiwoo.civet.base.enums;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by yuanguang on 2018/4/21.
 */
@AllArgsConstructor
@Getter
public enum OrderTradeSourceEnum {
    APP((byte)1,"用户", true),
    AEGIS((byte)2,"神盾", true),
    BALANCE_FULL_JOB((byte)3,"足额划扣job", true),
    BALANCE_PARTIAL_JOB((byte)4,"非足额划扣job", false),
    GUARANTEE_JOB((byte)5,"垫付job", true),
    WITHHOLD((byte)6,"代扣", true),
    ORGANIZATION_PC((byte)7,"机构pc", true),
    DAIHUAN_JOB((byte)8, "代还job", true);

    private Byte tradeSource;
    private String desc;
    private boolean needEnough;// 非提前结清标的状态是正常还款时是否一定要足额

    public static OrderTradeSourceEnum enumOf(Byte tradeSource) {

        for (OrderTradeSourceEnum orderTradeSourceEnum : values()) {
            if (orderTradeSourceEnum.tradeSource == tradeSource) {
                return orderTradeSourceEnum;
            }
        }
        throw new NoSuchEnumValueException("OrderTradeSourceEnum:" + tradeSource);
    }

}
